<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<script>
			var a = [1, 2, 3, [5, 21],
				[7, 8]
			];
			var ta = a.join(",").split(","); //转化为一维数组
			alert(Math.max.apply(null, ta)); //最大值
			alert(Math.min.apply(null, ta)); //最小值
		</script>
	</body>

</html>